package com.zzb.array;

import java.util.Scanner;

public class ArrayTest2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入一个整数作为数组长度：");
        int len = sc.nextInt();
        int[] arr = new int[len];
        System.out.println("输入数组元素：");
        for (int i = 0; i < len; i++) {
            arr[i] = sc.nextInt();
        }
        int min = arr[0];
        for (int num:arr) {
            if (min > num) {
                min = num;
            }
        }
        System.out.println("最小值为：" + min);

    }
}
